package com.yue.pattern.celue;


import com.yue.pattern.celue.payport.PayType;
import com.yue.pattern.celue.payport.Payment;

public class Order {

    private String uid;
    private String orderId;
    private double amount;

    public Order(String uid, String orderId, double amount) {
        this.uid = uid;
        this.orderId = orderId;
        this.amount = amount;
    }

    //这个参数，完全可以用Payment 接口来代替  为什么？
    // 策略模式最大特点：解决了Switch 的过程和 if else
    public PayState pay(PayType payType){

//        return payType.pay(this.uid,this.amount);

        return payType.get().pay(this.uid,this.amount);
    }

}
